﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL_Class;

namespace NLLSite.Administrator.UserControl
{
    public partial class ManageFeedBack : System.Web.UI.UserControl
    {
        LienHephanhoi li = new LienHephanhoi();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Panel1.Visible = true;
            TxrContent.Text = ((Label)GridView1.SelectedRow.FindControl("Label1")).Text;
        }

        protected void BtnDele_Click(object sender, EventArgs e)
        {
            
            foreach (GridViewRow row in GridView1.Rows)
            {
                CheckBox cb = (CheckBox)row.FindControl("Cbx");
                if (cb != null && cb.Checked)
                {
                    
                  li.DeleteFeedBack(Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value));
                }
            }
            GridView1.DataBind();
        }

        protected void Cbxdele_CheckedChanged(object sender, EventArgs e)
        {
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                CheckBox cb = (CheckBox)GridView1.Rows[i].FindControl("Cbx");
                if (Cbxdele.Checked)
                {
                    cb.Checked = true;
                }
                else
                {
                    cb.Checked = false;
                }
            }
        }
    }
}